package com.uzai.console.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 菜单权限平台类型
 * @Auther: liuqi
 * @Date: 2021/8/19 11:22
 * @Description:
 */
public enum MenuPlatformEnum {
    MAIN("main","主平台"),
    PRIVATE_WECHAT("private_wechat","个人微信"),
    ENTERPRISE_WECHAT("enterprise_wechat","企业微信"),
    MINI_PRO("mini_pro","程序"),
    WX_PUB("wx_pub","公众号"),
    TB("tb","淘宝"),
    JD("jd","京东"),
    PDD("pdd","拼多多"),
    VPH("vph","唯品会"),
    LOCAL_LIVE("local_live","本地生活"),
    Y_CHAT("y_chat","悠聊"),
    CMS("cms","CMS");

    private String key;
    private String desc;

    MenuPlatformEnum(String key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static MenuPlatformEnum getByKey(String key) {
        if (StringUtils.isBlank(key)) {
            return null;
        }
        for (MenuPlatformEnum type: MenuPlatformEnum.values()) {
            if (type.getKey().equals(key)) {
                return type;
            }
        }
        return null;
    }
}
